]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Add the workspaces view key to the gconf schema
authorDan Winship <danw@gnome.org>
Sat, 13 Feb 2010 21:39:13 +0000 (16:39 -0500)
committerDan Winship <danw@gnome.org>
Mon, 22 Feb 2010 22:01:47 +0000 (17:01 -0500)
Also rename the key to make it less ambiguous, and change its value
from an int to a string.

https://bugzilla.gnome.org/show_bug.cgi?id=609871

data/gnome-shell.schemas
js/ui/workspacesView.js

index 462a62e957d4ac83f0b9f0551b700ebcb6114984..bc3dd425ab69311b9c6c9516afc74aaa5e319c17 100644 (file)
         </locale>
       </schema>
 
+      <schema>
+        <key>/schemas/desktop/gnome/shell/overview/workspaces_view</key>
+        <applyto>/desktop/gnome/shell/overview/workspaces_view</applyto>
+        <owner>gnome-shell</owner>
+        <type>string</type>
+        <default>single</default>
+        <locale name="C">
+          <short>Overview workspace view mode</short>
+          <long>
+            The selected workspace view mode in the overview.
+            Supported values are "single" and "grid".
+          </long>
+        </locale>
+      </schema>
+
   </schemalist>
 
 </gconfschemafile>
index e129a76d01b35ff4886395feda29012de0dea0a4..5f03607ffd88c40fceb12fd56b0d6e695496c31e 100644 (file)
@@ -25,10 +25,13 @@ const WORKSPACE_SWITCH_TIME = 0.25;
 // Note that mutter has a compile-time limit of 36
 const MAX_WORKSPACES = 16;
 
+// The values here are also used for gconf, and the key and value
+// names must match
 const WorkspacesViewType = {
-    SINGLE: 0,
-    MOSAIC: 1
+    SINGLE: 'single',
+    GRID:   'grid'
 };
+const WORKSPACES_VIEW_KEY = 'overview/workspaces_view';
 
 function GenericWorkspacesView(width, height, x, y, animate) {
     this._init(width, height, x, y, animate);
@@ -950,24 +953,27 @@ function WorkspacesViewSwitch() {
 }
 
 WorkspacesViewSwitch.prototype = {
-    VIEW_KEY: 'view',
-
     _init: function() {
         this._gconf = Shell.GConf.get_default();
         this._mosaicViewButton = null;
         this._singleViewButton = null;
-        this._currentViewType = this._gconf.get_int(this.VIEW_KEY);
         this._controlsBar = null;
+
+        let view = this._gconf.get_string(WORKSPACES_VIEW_KEY).toUpperCase();
+        if (view in WorkspacesViewType)
+            this._currentViewType = WorkspacesViewType[view];
+        else
+            this._currentViewType = WorkspacesViewType.SINGLE;
     },
 
     _setView: function(view) {
-        this._mosaicViewButton.set_checked(WorkspacesViewType.MOSAIC == view);
+        this._mosaicViewButton.set_checked(WorkspacesViewType.GRID == view);
         this._singleViewButton.set_checked(WorkspacesViewType.SINGLE == view);
 
         if (this._currentViewType == view)
             return;
         this._currentViewType = view;
-        this._gconf.set_int(this.VIEW_KEY, view);
+        this._gconf.set_string(WORKSPACES_VIEW_KEY, view);
         this.emit('view-changed');
     },
 
@@ -975,7 +981,7 @@ WorkspacesViewSwitch.prototype = {
         switch (this._currentViewType) {
             case WorkspacesViewType.SINGLE:
                 return new SingleView(width, height, x, y, animate);
-            case WorkspacesViewType.MOSAIC:
+            case WorkspacesViewType.GRID:
                 return new MosaicView(width, height, x, y, animate);
             default:
                 return new MosaicView(width, height, x, y, animate);
@@ -988,7 +994,7 @@ WorkspacesViewSwitch.prototype = {
         this._mosaicViewButton = new St.Button({ style_class: "workspace-controls switch-mosaic" });
         this._mosaicViewButton.set_toggle_mode(true);
         this._mosaicViewButton.connect('clicked', Lang.bind(this, function() {
-            this._setView(WorkspacesViewType.MOSAIC);
+            this._setView(WorkspacesViewType.GRID);
         }));
         actor.add(this._mosaicViewButton, {'y-fill' : false, 'y-align' : St.Align.START});
 
@@ -999,7 +1005,7 @@ WorkspacesViewSwitch.prototype = {
         }));
         actor.add(this._singleViewButton, {'y-fill' : false, 'y-align' : St.Align.START});
 
-        if (this._currentViewType == WorkspacesViewType.MOSAIC)
+        if (this._currentViewType == WorkspacesViewType.GRID)
             this._mosaicViewButton.set_checked(true);
         else
             this._singleViewButton.set_checked(true);